﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;

namespace nwrole.toolbox.sync.entity
{
    public class nhEntityColumn 
    {
        public virtual long Id { get; set; }

        public virtual System.String Name { get; set; }

        public virtual string ColumnName { get; set; }

        public virtual string CSharpTypeName { get; set; }

        public virtual int SortIndex { get; set; }

        public virtual int? CSharpLength { get; set; }

        public virtual DateTime? CreatedDate { get; set; }

        public virtual DateTime? ModifiedDate { get; set; }

        public virtual string nhReferences { get; set; }

        public virtual string nhHasMany { get; set; }

        public virtual bool Nullable { get; set; }

        public virtual nhEntity nhEntity { get; set; }

    }

    public class nhEntityColumnMapping : ClassMap<nhEntityColumn>
    {
        
        public nhEntityColumnMapping() {
            Id(x => x.Id);
            Map(x => x.Name).Length(32).Not.Nullable();
            Map(x => x.SortIndex);
            Map(x => x.ColumnName);
            Map(x => x.CreatedDate);
            Map(x => x.ModifiedDate);
            Map(x => x.CSharpTypeName);
            Map(x => x.nhReferences);
            Map(x => x.nhHasMany);
            References(x => x.nhEntity).Column("nhEntityId");
        }

    }
}
